//
//  LLBShowViewController.m
//  LLBTestKit_Example
//
//  Created by lianglibao on 2019/10/20.
//  Copyright © 2019年 Spaino. All rights reserved.
//

#import "LLBShowViewController.h"

@interface LLBShowViewController ()

@end

@implementation LLBShowViewController
+ (void)show {
	LLBShowViewController *showVC = [[LLBShowViewController alloc] init];
	[[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:showVC animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];
	[self setupSubviews];
}

- (void)setupSubviews {
	self.view.backgroundColor = [UIColor whiteColor];
	
	CGFloat sWidth = UIScreen.mainScreen.bounds.size.width;
	CGFloat sHeight = UIScreen.mainScreen.bounds.size.height;
	[self.view addSubview:({
		CGFloat cWidth = 150;
		CGFloat lMargin = (sWidth - cWidth)/2.0;
		UILabel *tLabel = [[UILabel alloc] initWithFrame:CGRectMake(lMargin, 40, cWidth, 28)];
		tLabel.text = @"我是PodsVC";
		tLabel.textColor = [UIColor blackColor];
		tLabel.font = [UIFont systemFontOfSize:18];
		tLabel.textAlignment = NSTextAlignmentCenter;
		tLabel;
	})];
	
	[self.view addSubview:({
		CGFloat cWidth = 150;
		CGFloat lMargin = (sWidth - cWidth)/2.0;
		CGFloat tMargin = (sHeight - 50)/2.0;
		UIButton *tButton = [[UIButton alloc] initWithFrame:CGRectMake(lMargin, tMargin, cWidth, 50)];
		tButton.titleLabel.font = [UIFont systemFontOfSize:22];
		[tButton setBackgroundColor:[UIColor lightGrayColor]];
		[tButton setTitle:@"关闭页面" forState:UIControlStateNormal];
		[tButton setTitle:@"关闭页面" forState:UIControlStateHighlighted];
		[tButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
		[tButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
		[tButton addTarget:self action:@selector(dissmisAction) forControlEvents:UIControlEventTouchUpInside];
		tButton;
	})];
}

- (void)dissmisAction {
	[self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
